package service;

import dao.BookStautsDao;


import domin.Book;
import domin.BookCategory;
import domin.BookStatus;
import util.Condition;
import util.JdbcHelper;
import util.Pagination;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;

public class BookStautsService {
    private BookStautsDao bookStautsDao = BookStautsDao.getInstance();
    private static  BookStautsService bookservice = new  BookStautsService();
    public static BookStautsService getInstance(){
        return  bookservice;
    }
    public BookStatus find(int id) throws SQLException {
        Connection connection = JdbcHelper.getConn();
        BookStatus bookStatus = bookStautsDao.find(connection,id);
        return bookStatus;
    }

    public Collection<BookStatus> findAll(Collection<Condition> condition, Pagination pagination) throws SQLException {
        Connection connection = JdbcHelper.getConn();
        Collection<BookStatus> degrees = bookStautsDao.findAll(connection,condition,pagination);
        JdbcHelper.close(connection);
        return degrees;
    }
    public boolean update(BookStatus book) throws SQLException {
        Connection connection = JdbcHelper.getConn();
        boolean updated = bookStautsDao.update(connection,book);
        JdbcHelper.close(connection);
        return updated;
    }

}
